package com.boss.common;

public class StrUtils {

	public static int calculateStrLength(String value) {
		int chineseLen=0;
		int engLen=0; 
		String chinese = "[\u4e00-\u9fa5]";
		for (int i = 0; i < value.length(); i++) {
			String temp = value.substring(i, i + 1);
			if (temp.matches(chinese)) { 
				chineseLen+=1;
			} else { 
				engLen+=1;
			}
		}
//		System.out.println("英文字符"+engLen+"个");
//		System.out.println("中午字符"+chineseLen+"个");
		int valueLength=chineseLen*3+engLen; 
//		System.out.println("共有字符:"+valueLength+"个");
		return valueLength;
	}
 
}
